<template>
	<view class="box">
		<view class="first">
			<input v-model="nickName" placeholder="请输入您的昵称" class="input" />
		</view>
		<view class="second">2-16个汉字，可由英文、数字、符号组成</view>
		<view class="third" @click="onSubmit">确定</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nickName: '',
			}
		},
		methods: {
			onSubmit() {
				if (!this.nickName) return uni.showToast({
					title: '请输入昵称',
					icon: 'none'
				});
				uni.$emit('updateName', {
					nickName: this.nickName
				});
				uni.navigateBack({
					delta: 1,
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	page {
		background: #F5F7FA;
	}

	@import './index.less';
</style>